<%@ Language=VBScript %>
<%Option Explicit%>

<!--#include file="../cons.asp"-->
<!--#include file="../../Common/Database.asp"-->

<%
	response.CacheControl = "no-cache"
	Dim oConn, sSQL, oRS
	Dim IdCurso, iPlanilla, iPrimero
	
	IdCurso = request("IdCurso")

    if IdCurso = "35" or IdCurso = "36" or IdCurso = "37" or IdCurso="38" or IdCurso="39" or IdCurso="40" then
        iPlanilla = 4
    end if
    if IdCurso = "31" or IdCurso = "33" or IdCurso = "34" then
        iPlanilla = 3
    end if
    if IdCurso = "45" then
        iPlanilla = 2
    end if
    if IdCurso = "41" or IdCurso = "42" or IdCurso = "43" or IdCurso = "44" then
        iPlanilla = 1
    end if
	
	Set oConn = OpenConnection
	
	sSQL=	"select distinct P.NroPeriodo,  Descripcion " & _
            "from Periodos P " & _
            "inner join Curso C on (C.IdCurso = " & IdCurso & ") " & _
            "where P.IdTipoPlanilla = " & iPlanilla & " and P.IdSede = C.IdSede"
	
	'response.Write sSQL
	'response.End
	Set oRS = oConn.Execute(sSQL)

	response.Write "<select id=""cmb_Trimestres"" style=""font-family: Verdana; font-size: 10px;"" onchange=""GetChart(IdMateria, cmb_Cursos.value, this.value); GetListadoAlumnos(IdMateria, cmb_Cursos.value, this.value);"">"
	response.Write "<option value='T'>Promedio General</option>"
	iPrimero = 0
	while not oRS.EOF
		response.Write "<option value='" & oRS("NroPeriodo") & "'"
		if iPrimero = 0 then
		    response.write " selected"
		    iPrimero = 1
		end if
		response.write ">"
		response.Write server.HTMLEncode(oRS("Descripcion"))
		response.Write "</option>"
		oRS.MoveNext()
	wend
	response.Write "</select>"
%>